package org.snail.exception;

import lombok.Data;

@Data
public class JsonResult<T> {
    public static final int SUCCESS = 200;
    public static int ERROR = 0;
    private int code;
    private String message;
    private T data;
    public JsonResult(){
        this.code=SUCCESS;
    }
    public JsonResult(T obj){
        this.code = SUCCESS;
        this.data = obj;
    }
    public JsonResult(Throwable error){
        this.message=error.getMessage();
    }
    @Override
    public String toString() {
        return "JsonResult{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}

